package com.sdk.es.sdk.helper;

import org.springframework.stereotype.Component;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

@Component
public class EsIndexNameGenerator {
    private final DateTimeFormatter yearMonthFormatter = DateTimeFormatter.ofPattern("yyyy-MM");

    public String getYearMonthStr() {
        return LocalDate.now().format(yearMonthFormatter);
    }


    private final DateTimeFormatter yearAndMonthFormatter = DateTimeFormatter.ofPattern("yyyyMM");

    public String getYearAndMonthStr() {
        return LocalDate.now().format(yearAndMonthFormatter);
    }
}
